package org.example.day20250111;

import org.apache.doris.flink.cfg.DorisOptions;
import org.apache.doris.flink.cfg.DorisReadOptions;
import org.apache.doris.flink.deserialization.SimpleListDeserializationSchema;
import org.apache.doris.flink.source.DorisSource;
import org.apache.flink.api.common.eventtime.WatermarkStrategy;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.example.day20250105.flink.DorisConstant;

import java.util.List;

/**
 * @className: HandleDetailRecordData
 * @author: 孙磊
 * @date: 2025/1/11 22:11
 * @Version: 1.0
 * @description:
 */
public class HandleDetailRecordData {
    public static void main(String[] args) throws Exception {
        final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        //读取详情数据
        DorisOptions.Builder builder = DorisOptions.builder()
                .setFenodes(DorisConstant.FE_NODE_URL)
                .setTableIdentifier(DorisConstant.DB_NAMME + ".ods_xw_test_flow")
                .setUsername(DorisConstant.USERNAME)
                .setPassword(DorisConstant.PASSWORD);
        DataStreamSource<List<?>> testFlowDataStream = env.fromSource(DorisSource.<List<?>>builder()
                        .setDorisOptions(builder.build())
                        .setDorisReadOptions(DorisReadOptions.builder().build())
                        .setDeserializer(new SimpleListDeserializationSchema())
                        .build()
                , WatermarkStrategy.noWatermarks(),
                "读取详情数据");
        env.execute();
    }
}
